package com.ruoyi;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 * 启动程序
 * 
 * @author ruoyi
 */
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class RuoYiApplication
{
    public static void main(String[] args)
    {
        // System.setProperty("spring.devtools.restart.enabled", "false");

        SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL);

        // 启用虚拟线程相关JVM参数
        System.setProperty("jdk.virtualThreadScheduler.parallelism",
                String.valueOf(Runtime.getRuntime().availableProcessors()));
        System.setProperty("jdk.virtualThreadScheduler.maxPoolSize", "256");

        System.out.println("==========================================");
        System.out.println("Java Version: " + System.getProperty("java.version"));
        System.out.println("CPU Cores: " + Runtime.getRuntime().availableProcessors());
        System.out.println("Virtual Threads Supported: " + Thread.ofVirtual().name("test").start(() -> {}).isVirtual());
        System.out.println("==========================================");

        SpringApplication.run(RuoYiApplication.class, args);
    }
}
